/**
 * 监控页面共享样式
 */

// ==================== 全局样式变量 ====================
$primary-color: #409EFF;
$success-color: #67C23A;
$warning-color: #E6A23C;
$danger-color: #F56C6C;
$info-color: #909399;

$text-primary: #303133;
$text-regular: #606266;
$text-secondary: #909399;

$border-color: #EBEEF5;
$background-color: #f5f7fa;

$border-radius: 8px;
$box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
$box-shadow-hover: 0 4px 8px rgba(0, 0, 0, 0.15);

// ==================== 通用样式 ====================
.app-container {
  padding: 20px;
  background-color: $background-color;
  min-height: calc(100vh - 84px);
}

// ==================== 卡片样式 ====================
.monitor-card {
  background: white;
  border-radius: $border-radius;
  box-shadow: $box-shadow;
  border: none;
  transition: all 0.3s ease;

  &:hover {
    box-shadow: $box-shadow-hover;
  }

  .card-header {
    background-color: #fafafa;
    border-bottom: 1px solid $border-color;
    padding: 16px 20px;

    .clearfix {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
  }

  .card-body {
    padding: 20px;
  }
}

// ==================== 按钮样式 ====================
.monitor-button {
  border-radius: 4px;

  &.primary {
    background-color: $primary-color;
    border-color: $primary-color;

    &:hover {
      background-color: #66b1ff;
      border-color: #66b1ff;
    }
  }
}

.monitor-button-group {
  .monitor-button {
    &:first-child {
      border-top-right-radius: 0;
      border-bottom-right-radius: 0;
    }

    &:last-child {
      border-top-left-radius: 0;
      border-bottom-left-radius: 0;
    }

    &:not(:first-child):not(:last-child) {
      border-radius: 0;
    }
  }
}

// ==================== 标签样式 ====================
.monitor-tag {
  border-radius: 4px;
}

// ==================== 区域标题样式 ====================
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;

  h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: $text-primary;
  }
}

// ==================== 数值状态样式 ====================
.value-normal {
  color: $success-color;
}

.value-warning {
  color: $warning-color;
}

.value-danger {
  color: $danger-color;
}

// ==================== 状态指示器样式 ====================
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;

  &.online {
    background-color: $success-color;
  }

  &.warning {
    background-color: $warning-color;
  }

  &.offline {
    background-color: $danger-color;
  }
}

// ==================== 趋势指示器样式 ====================
.trend-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;

  .trend-up {
    color: $danger-color;
  }

  .trend-down {
    color: $success-color;
  }
}

// ==================== 设备信息样式 ====================
.device-info {
  .device-name {
    font-weight: 500;
    color: $text-primary;
    margin-bottom: 2px;
  }

  .device-code {
    font-size: 12px;
    color: $text-secondary;
  }
}

// ==================== 时间信息样式 ====================
.time-info {
  .time-detail {
    font-size: 12px;
    color: $text-secondary;
    margin-top: 2px;
  }
}

// ==================== 更新时间样式 ====================
.update-time {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: $text-secondary;

  i {
    color: $primary-color;
  }
}

// ==================== 表格样式 ====================
.monitor-table {
  .table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-top: 1px solid $border-color;

    .table-info {
      font-size: 14px;
      color: $text-regular;

      span {
        margin-right: 16px;
      }
    }
  }
}

// ==================== 对话框样式 ====================
.monitor-dialog {
  border-radius: $border-radius;

  .dialog-header {
    background-color: #fafafa;
    border-bottom: 1px solid $border-color;
  }
}

// ==================== 响应式设计 ====================
@media (max-width: 1200px) {
  .metric-value {
    .value {
      font-size: 24px !important;
    }
  }
}

@media (max-width: 768px) {
  .app-container {
    padding: 10px;
  }

  .monitor-header {
    flex-direction: column;
    gap: 16px;

    .header-left,
    .header-right {
      width: 100%;
      justify-content: center;
    }
  }

  .quick-filter {
    flex-direction: column;
    gap: 12px;
  }

  .metric-card {
    padding: 16px !important;

    .metric-value {
      .value {
        font-size: 20px !important;
      }
    }
  }

  .status-card {
    padding: 12px !important;

    .status-content {
      .status-count {
        font-size: 18px !important;
      }
    }
  }
}

// ==================== 动画效果 ====================
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

// ==================== 加载状态样式 ====================
.loading-overlay {
  position: relative;

  &::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
  }
}

// ==================== 工具类 ====================
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.mb-16 {
  margin-bottom: 16px;
}

.mb-20 {
  margin-bottom: 20px;
}

.mt-16 {
  margin-top: 16px;
}

.p-16 {
  padding: 16px;
}

.p-20 {
  padding: 20px;
}
